package com.cgbl.cg.ui.work

import android.os.Bundle
import com.alibaba.android.arouter.facade.annotation.Route
import com.cgbl.cg.BR
import com.cgbl.cg.R
import com.cgbl.cg.adapter.HomeTabAdapter
import com.cgbl.cg.adapter.WorksListAdapter
import com.cgbl.cg.databinding.AppActivityWorksListBinding
import com.cgbl.cg.vm.work.WorksListViewModel
import com.robot.base.base.activity.GLBaseActivity
import com.robot.base.configs.AppConstants

@Route(path = AppConstants.Router.WORK.A_WORKS_LIST)
class WorksListActivity:GLBaseActivity<AppActivityWorksListBinding, WorksListViewModel>() {

    private lateinit var worksListAdapter: WorksListAdapter
    private lateinit var homeTabAdapter: HomeTabAdapter

    override fun initContentView(savedInstanceState: Bundle?): Int = R.layout.app_activity_works_list

    override fun initVariableId(): Int = BR.viewModel

    override fun initComponents() {

        initAdapter()
    }

    override fun initData() {
        super.initData()
        viewModel.initData()
    }
    private fun initAdapter(){
        homeTabAdapter = HomeTabAdapter(false)
        binding.recyclerViewTab.apply {
            adapter = homeTabAdapter
        }

        worksListAdapter = WorksListAdapter()
        binding.recyclerViewWorks.apply {
            adapter = worksListAdapter
        }
        worksListAdapter.setNewInstance(arrayListOf("","","","","","",""))
    }

    override fun initViewObservable() {
        super.initViewObservable()
        viewModel.uc.tabData.observe(this) {
//            homeTabAdapter.setNewInstance(it)
        }
    }
}